<?php
//生成器读取文jian
//使用生成器读取文件的有点是,内存小

function readTxt() {
  
    $file = fopen('bb.txt','r');
  
    while ($file&&!feof($file)) {
       yield  fgets($file);
    }
    $file&&fclose($file);
}
$txt=readTxt();
 foreach ($txt as $line) {
   // $line = trim($line);
    echo $line."\n";
 }